package cn.tedu.micro.demo.client.delay;

import cn.tedu.micro.demo.client.RabbitChannelManager;
import com.rabbitmq.client.Channel;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;

import java.io.IOException;

/**
 * 测试产生死信拒绝逻辑
 */
@Slf4j
public class DelayConsumer {
    @Test
    public void consume() throws IOException, InterruptedException {
        Channel channel = RabbitChannelManager.newChannel();
        channel.basicConsume("delay_q",true,
                ((consumerTag, message) -> {
                    log.info("消息被消费者接收");
                }),
                (consumerTag) -> { /*TODO 不编辑消费取消回调*/ });
        //为了看到消费处理逻辑打印日志 不能让主线程停止
        Thread.sleep(10000000);
    }
}
